import requests
import time

url = "http://127.0.0.1:55556/nl2api"

start = time.time()
ls = ["查询浙江嘉化的上游来水数据", "查询下游排海数据", "查看2025年4月8日实验室数据", "查看今天的巡检记录", "查询过去7日的药剂库存变化数据"]
for l in ls:
    try:
        with requests.post(url, json= {"messages":[{"role": "user", "content": l}]}, stream=True) as response:
            response.raise_for_status()  # 验证请求状态
            for chunk in response.iter_content(chunk_size=100000):
                if chunk:
                    print(chunk.decode('utf-8'), end='', flush=True)  # 实时输出文本
    except Exception as e:
        pass
